package com.msa.msaportal.dao.impl;
import com.msa.msaportal.common.hibernate.HibernateSimpleDao;
import com.msa.msaportal.dao.IHeaderDao;
import com.msa.msaportal.entity.PortalheaderEntity;

public class HeaderDaoImpl  extends HibernateSimpleDao implements  IHeaderDao {

	@Override
	public void addHeader(PortalheaderEntity header) {
		
		this.sessionFactory.getCurrentSession().save(header);		
	}

	@Override
	public void delete(String headerId) {
		
		String hql="from PortalheaderEntity where hsource_id=?";
		PortalheaderEntity header=(PortalheaderEntity)super.findUnique(hql, headerId);
		
		/*Integer id = Integer.valueOf(headerId);
		Header header= (Header) this.sessionFactory.getCurrentSession().load(Header.class,id);*/
		if (headerId!=null) {
		this.sessionFactory.getCurrentSession().delete(header);
		}
		
				
	}
	
	public  PortalheaderEntity find(String headerId) {
		String hql="from PortalheaderEntity where hsource_id=?";
		PortalheaderEntity header=(PortalheaderEntity)super.findUnique(hql, headerId);	
		return   header;
}

	@Override
	public void updater(PortalheaderEntity header) {
		// TODO Auto-generated method stub
		this.getSession().update(header);
	}
	
	
	
}
